Skip to content

fix(tutorials): retry flaky PyPI fetches in pydantic_ai images - #547

Merged
danielmillerp merged 1 commit into
mainfrom
dm/retry-pydantic-ai-pypi-fetches
Oct 9, 2026
Merged

danielmillerp merged 1 commit into
mainfrom
dm/retry-pydantic-ai-pypi-fetches

Conversation

@danielmillerp

@danielmillerp danielmillerp commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What changed

The two 110_pydantic_ai tutorial image builds failed four times when a PyPI download dropped mid-stream in uv pip install ("Failed to fetch … broken pipe" or a TLS EOF), mostly in the emulated arm64 half of the build. uv 0.6.4 doesn't retry that error. One failure hit a publish run, so the 00_base :latest image wasn't updated.

In 10_async/00_base/110_pydantic_ai/Dockerfile and 10_async/10_temporal/110_pydantic_ai/Dockerfile:

  • The uv pip install --system .[dev]… step runs up to 3 times, waiting 10 s and then 20 s between attempts. If all 3 fail, the build still fails.
  • UV_CONCURRENT_DOWNLOADS=4 (uv's default is 50), so the slow arm64 build opens fewer connections at once.

Not changed: the uv version. All 35 tutorial Dockerfiles pin uv 0.6.4, each on its own line. Bumping two would split the pin, and moving all 35 to 0.12.x is bigger than this fix. That's a separate PR. The publish workflow's platforms are unchanged too.

How this was verified

  • Retry loop logic: ran the same loop with a stand-in command:

    Case Result
    Succeeds first time exit 0, no retries
    Fails twice, then succeeds 2 "failed (attempt n of 3)" lines, exit 0
    Fails every time 3 failure lines, exit 1, so the build fails
  • Image builds: this PR's CI builds both images for linux/amd64 and linux/arm64 and runs their tests. I couldn't build them locally because my local Docker disk was full.

  • Not tested: a real mid-download PyPI failure, which can't be forced on demand.

🤖 Generated with Claude Code

RetriggerConfidence Score: 5/5

The PR appears safe to merge; both images still fail to build if all install attempts fail.

Summary

Both 110_pydantic_ai tutorial image builds limit PyPI downloads and retry package installs. This gives temporary download interruptions another chance to recover, especially in the slow emulated arm64 builds.

  • Both pydantic_ai tutorial images limit downloads and retry package installs.

Reviews (3) · Last reviewed commit: "fix(tutorials): retry flaky PyPI fetches..." · Reviewed by Greptile

Both 110_pydantic_ai image builds failed four times when a PyPI download
dropped mid-stream during uv pip install, mostly in the emulated arm64
half. uv 0.6.4 doesn't retry that error. Retry the install up to three
times (10s, then 20s backoff) and lower parallel downloads to 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danielmillerp
danielmillerp force-pushed the dm/retry-pydantic-ai-pypi-fetches branch from c3ea90d to e7b52f0 Compare October 9, 2026 01:34
@danielmillerp
danielmillerp changed the base branch from next to main October 9, 2026 01:34
@danielmillerp danielmillerp reopened this Oct 9, 2026
@danielmillerp
danielmillerp merged commit 3ae74c4 into main Oct 9, 2026
68 checks passed
@danielmillerp
danielmillerp deleted the dm/retry-pydantic-ai-pypi-fetches branch October 9, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant